#include<iostream>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
    string str;
    getline(cin, str);
    int begin = 0, end = 0;
    while (end < str.size()) {
        if (str[end] == ' ' || str[end] == '\0') {
            reverse(&str[begin], &str[end]);
            end++;
            begin = end;
        }
        else {
            end++;
        }

    }
    reverse(&str[begin], &str[end]);
    reverse(&str[0], &str[end]);
    cout << str << endl;
    return 0;
}